<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>kaoshi2</title>
    <link rel="stylesheet" href="kaoshi2.css">
</head>
<body>

    <form>
        <label>品牌：</label><input placeholder="请输入品牌.." id="pingpai"><br>
        <label>型号：</label><input placeholder="请输入型号.." id="xinghao"><br>
        <label>参数：</label><input placeholder="请输入参数.." id="canshu"><br>
        <label>价格：</label><input placeholder="请输入价格.." id="jiage"><br>
        <label for="sport" id="guobie">国别：</label>
        <select class="s1">
            <option value="0">请选择国别..</option>
            <option value="1">中国</option>
            <option value="2">日本</option>
            <option value="3">美国</option>
            <option value="4">英国</option>
            <option value="5">德国</option>
            <option value="6">法国</option>
            <option value="7">新加坡</option>
        </select> <br>

        <input name="submit" type="button" value="添加信息" onclick="return submitTable()" >
    </form>
    <table width="400px" border="1" cellspacing="0" cellpadding="0" id="tb">
        <tr bgcolor="#861251">
            <th>品牌</th>
            <th>型号</th>
            <th>参数</th>
            <th>价格</th>
            <th>国别</th>
        </tr>
        <tr>
            <td>&nbsp&nbsp</td>
            <td>&nbsp&nbsp</td>
            <td>&nbsp&nbsp</td>
            <td>&nbsp&nbsp</td>
            <td>&nbsp&nbsp</td>
        </tr>
    </table>

    <script language="text/JavaScript">
        function submitTable() {


            var a=document.getElementById("pingpai").value;
            var b=document.getElementById("xinghao").value;
            var c=document.getElementById("canshu").value;
            var d=document.getElementById("jiage").value;


            if(a == null || a=="")
{alert('不能输入空值');return false}
if(b == null || b=="")
{alert('不能输入空值');return false}
if(c == null || c=="")
{alert('不能输入空值');return false}
if(d == null || d=="")
{alert('不能输入空值');return false}
        }
        document.write(a);
        document.write(b);
        document.write(c);
        document.write(d);

    </script>
</body>
</html>